home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group94a.txt / 000064_icon-group-sender _Fri Feb 25 08:49:50 1994.msg < prev    next >
Internet Message Format  |  1994-08-19  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Fri, 25 Feb 1994 08:39:05 MST
  2. Date: Fri, 25 Feb 1994 08:49:50 -0600 (CST)
  3. From: Chris Tenaglia - 257-8765 <TENAGLIA@MIS.MCW.EDU>
  4. Subject: kbhit(), getch(), read()
  5. To: icon-group@cs.arizona.edu
  6. Cc: icon-project@cs.arizona.edu
  7. Message-Id: <01H9AODUV2SI8WWBLD@mis.mcw.edu>
  8. Organization: Medical College of Wisconsin (Milwaukee, WI)
  9. X-Vms-To: IN%"icon-group@cs.arizona.edu"
  10. X-Vms-Cc: IN%"icon-project@cs.arizona.edu"
  11. Mime-Version: 1.0
  12. Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  13. Content-Transfer-Encoding: 7BIT
  14. Status: R
  15. Errors-To: icon-group-errors@cs.arizona.edu
  16.  
  17.  
  18. I wrote a nifty program in DOS Icon V8.10. It used kbhit(), getch(),
  19. and read() in certain ways. This was to make an intuitive user interface.
  20. Now for work I use Icon V8.10 on VAX/VMS 5.5. I hoped that the only
  21. differences would be the fancy key strings and drawing characters.
  22. However, the kbhit(), getch(), and read() work differently and the same
  23. program user interface doesn't work well. Is it spelled out anywhere
  24. what these behaviour differences are? I'd like to port to unix too,
  25. except that getch() under ultrix doesn't work right either.
  26.  
  27. Under VMS if I don't use kbhit() and getch() and instead do all character
  28. input using read() all behaves as expected. Once I start using them, it
  29. seems that some characters overflow. So when I hit a read() from &stdin
  30. the first character disappears as if a getch() somewhere else intercepted
  31. it. Then when I terminate the read() by pressing <RETURN>, the <RETURN>
  32. character gets intercepted by a kbhit()/getch() somewhere else, and this
  33. causes strange behavior in a user interface. Is there a way to flush the
  34. buffers at certain points and start fresh when needed? Has anyone else
  35. encountered these alternate behaviours?
  36.  
  37. The best I could do for now is to emulate read() with a getch() loop,
  38. but it too seems to pick up \r at random intervals. Does it matter that
  39. I'm using ansi escape sequences to turn the cursor off and on where
  40. appropriate?
  41.  
  42. Chris.
  43.  
  44.